package cn.com.huzo.repository.trade.impl;

import cn.com.huzo.model.entities.trade.DeliveryCommandSheetLinesMoEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.trade.DeliveryCommandSheetLinesMoRepository;

/**
 * 发货发令单明细-引入生产指示书数据访问类实现。
 *
 * @author 吴旭
 */
@Repository("DeliveryCommandSheetLinesMoRepository")
public class DeliveryCommandSheetLinesMoRepositoryImpl extends GenericRepositoryImpl<DeliveryCommandSheetLinesMoEntity, String>
        implements DeliveryCommandSheetLinesMoRepository {

    private final String namespace = "cn.com.huzo.repository.trade.DeliveryCommandSheetLinesMoRepository";

    /**
     * 构造函数,设置the entity to DeliveryCommandSheetHeaderRepositoryImpl.class.
     */
    public DeliveryCommandSheetLinesMoRepositoryImpl() {
        super(DeliveryCommandSheetLinesMoEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<DeliveryCommandSheetLinesMoEntity> fetchByHeaderId(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderKey"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<DeliveryCommandSheetLinesMoEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<DeliveryCommandSheetLinesMoEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemList);
    }

    /**
     * {@inheritDoc}
     * <p>
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
